﻿using System.Collections;

namespace Swimj.DataCore
{
    public class ConditionCollection : IList<ConditionDescriptor>
    {
        private IList<ConditionDescriptor> _conditionParameters;

        public ConditionDescriptor this[int index]
        {
            get => _conditionParameters[index];
            set => _conditionParameters[index] = value;
        }

        public int Count => _conditionParameters.Count;

        public bool IsReadOnly => _conditionParameters.IsReadOnly;

        public ConditionCollection()
        {
            _conditionParameters = new List<ConditionDescriptor>();
        }

        public void Add(ConditionDescriptor item)
        {
            _conditionParameters.Add(item);
        }

        public void Add(string parameterName, object value)
        {
            Add(parameterName, value, ConditionType.Equal);
        }

        public void Add(string parameterName, object value, ConditionType conditionType)
        {
            _conditionParameters.Add(new ConditionDescriptor()
            {
                ParameterName = parameterName,
                Value = value,
                ConditionType = conditionType
            });
        }

        public void Clear()
        {
            _conditionParameters.Clear();
        }

        public bool Contains(ConditionDescriptor item)
        {
            throw new NotImplementedException();
        }

        public void CopyTo(ConditionDescriptor[] array, int arrayIndex)
        {
            throw new NotImplementedException();
        }

        public IEnumerator<ConditionDescriptor> GetEnumerator()
        {
            return _conditionParameters.GetEnumerator();
        }

        public int IndexOf(ConditionDescriptor item)
        {
            throw new NotImplementedException();
        }

        public void Insert(int index, ConditionDescriptor item)
        {
            throw new NotImplementedException();
        }

        public bool Remove(ConditionDescriptor item)
        {
            throw new NotImplementedException();
        }

        public void RemoveAt(int index)
        {
            throw new NotImplementedException();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return _conditionParameters.GetEnumerator();
        }
    }
}